/ Assembly List / LJCTextDataReaderLib / TextDataReader / LJCSetFile

Namespace - LJCTextDataReaderLib


Parameters
fileName - The delimited text file name.
fieldDelimiter - The field delimiter.

Syntax

C#
public Void LJCSetFile(String fileName, Char fieldDelimiter = ,)

Sets the source text file values. (E)

Example

C#
// File Contents
// FirstName, LastName
// John, Doe
// Jane, Doe
        
using LJCTextDataReaderLib;

// The input file has a data configuration heading line.
// The hasHeadingLine defaults to true if the parameter is not included.
TextDataReader textReader = new TextDataReader();

// Use comma as the field delimiter. Any single character can be used.
// The field delimiter defaults to "," if the parameter is not included.
textReader.LJCSetFile("InputFileSpec.txt");
      
while(textReader.Read())
{
  // Get the current line values as strings.
  for int index = 0; index < textReader.FieldCount; index++)
  {
    string data = textReader.GetString(index);
  }
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.